//
//  HACTecNode.m
//  HStockCharts
//
//  Created by Hotacool on 2018/9/28.
//

#import "HACTecNode.h"
#import "_HACTecNodeVolume.h"
#import "_HACTecNodeAmount.h"
#import "_HACTecNodeMACD.h"
#import "_HACTecNodeKDJ.h"
#import "_HACTecNodeRSI.h"
#import "_HACTecNodeBOLL.h"
#import "_HACTecNodeLineType.h"

#define kTextFontSize 10.0
@interface HACTecNode ()
@property (nonatomic, strong) HACChartNode *currentTecNode;
@end

@implementation HACTecNode

- (instancetype)initWithHostLayer:(CALayer *)layer tecType:(HACTecType)type {
    if (self = [self initWithHostLayer:layer]) {
        _currentTecNode = [self getTecNodeWithType:type];
        _tecType = type;
    }
    return self;
}

- (void)removeNode {
    [super removeNode];
    [self.currentTecNode removeNode];
}

- (void)setTecType:(HACTecType)tecType {
    if (_tecType != tecType) {
        [self.currentTecNode removeNode];
        HACChartNode *newTecNode = [self getTecNodeWithType:tecType];
        [newTecNode setData:self.data];
//        newTecNode.itemsSpace = self.itemsSpace;
        newTecNode.relativeFrame = self.relativeFrame;
        newTecNode.visualCount = self.visualCount;//visualcount 触发 pointrect计算，需放在前面
        newTecNode.pointRect = self.pointRect;
        newTecNode.startIndex = self.startIndex;
        newTecNode.endIndex = self.endIndex;
        self.currentTecNode = newTecNode;
        _tecType = tecType;
    }
}

- (void)setRelativeFrame:(CGRect)relativeFrame {
    if (self.currentTecNode) {
        [self.currentTecNode setRelativeFrame:relativeFrame];
    }
}

- (CGRect)relativeFrame {
    return self.currentTecNode.relativeFrame;
}

- (void)setPointRect:(CGRect)pointRect {
    if (self.currentTecNode) {
        [self.currentTecNode setPointRect:pointRect];
    }
}

- (BOOL)isSoildFill {
    return self.currentTecNode.isSoildFill;
}

- (void)setIsSoildFill:(BOOL)isSoildFill {
    self.currentTecNode.isSoildFill = isSoildFill;
}

- (CGRect)pointRect {
    return self.currentTecNode.pointRect;
}

- (void)setVisualCount:(NSInteger)visualCount {
    if (self.currentTecNode) {
        [self.currentTecNode setVisualCount:visualCount];
    }
}

- (NSInteger)visualCount {
    return self.currentTecNode.visualCount;
}

- (void)setItemsSpace:(CGFloat)itemsSpace {
    if (self.currentTecNode) {
        [self.currentTecNode setItemsSpace:itemsSpace];
    }
}

- (CGFloat)itemsSpace {
    return self.currentTecNode.itemsSpace;
}

- (void)setNeedsDisplay {
    if (self.currentTecNode) {
        [self.currentTecNode setNeedsDisplay];
    }
}

- (void)setData:(HACChartData *)data {
    if (self.currentTecNode) {
        [self.currentTecNode setData:data];
    }
}

- (HACChartData *)data {
    return self.currentTecNode.data;
}

- (void)setStartIndex:(NSInteger)startIndex {
    if (self.currentTecNode) {
        [self.currentTecNode setStartIndex:startIndex];
    }
}

- (NSInteger)startIndex {
    return self.currentTecNode.startIndex;
}

- (void)setEndIndex:(NSInteger)endIndex {
    if (self.currentTecNode) {
        [self.currentTecNode setEndIndex:endIndex];
    }
}

- (NSInteger)endIndex {
    return self.currentTecNode.endIndex;
}

- (CGFloat)singleWidth {
    return self.currentTecNode.singleWidth;
}

- (HACChartNode*)getTecNodeWithType:(HACTecType)type{
    HACChartNode *node;
    switch (type) {
        case HACTecTypeVolume: {
            node = [[_HACTecNodeVolume alloc] initWithHostLayer:self.hostLayer];
            break;
        }
        case HACTecTypeAmount: {
            node = [[_HACTecNodeAmount alloc] initWithHostLayer:self.hostLayer];
            break;
        }
        case HACTecTypeMACD: {
            node = [[_HACTecNodeMACD alloc] initWithHostLayer:self.hostLayer];
            break;
        }
        case HACTecTypeKDJ: {
            node = [[_HACTecNodeKDJ alloc] initWithHostLayer:self.hostLayer];
            break;
        }
        case HACTecTypeRSI: {
            node = [[_HACTecNodeRSI alloc] initWithHostLayer:self.hostLayer];
            break;
        }
        case HACTecTypeBOLL: {
            node = [[_HACTecNodeBOLL alloc] initWithHostLayer:self.hostLayer];
            break;
        }
        case HACTecTypePSY: {
            node = [[_HACTecNodePSY alloc] initWithHostLayer:self.hostLayer];
            break;
        }
        case HACTecTypeOBV: {
            node = [[_HACTecNodeOBV alloc] initWithHostLayer:self.hostLayer];
            break;
        }
        case HACTecTypeDMI: {
            node = [[_HACTecNodeDMI alloc] initWithHostLayer:self.hostLayer];
            break;
        }
        case HACTecTypeWR: {
            node = [[_HACTecNodeWR alloc] initWithHostLayer:self.hostLayer];
            break;
        }
        case HACTecTypeASI: {
            node = [[_HACTecNodeASI alloc] initWithHostLayer:self.hostLayer];
            break;
        }
        case HACTecTypeDMA: {
            node = [[_HACTecNodeDMA alloc] initWithHostLayer:self.hostLayer];
            break;
        }
        case HACTecTypeBIAS: {
            node = [[_HACTecNodeBIAS alloc] initWithHostLayer:self.hostLayer];
            break;
        }
        case HACTecTypeVR: {
            node = [[_HACTecNodeVR alloc] initWithHostLayer:self.hostLayer];
            break;
        }
        case HACTecTypeCCI: {
            node = [[_HACTecNodeCCI alloc] initWithHostLayer:self.hostLayer];
            break;
        }
        default:
            break;
    }
    return node;
}

- (NSAttributedString*)lastValueString{
    return [self stringAtChartForIndex:self.endIndex];
    
}
- (HACChartDataEntry*)lastValue{
    if (self.currentTecNode) {
        HACChartDataEntry *data = [self.currentTecNode dataAtChartForIndex:self.endIndex];
        return data;
    }
    return nil;
}
- (NSAttributedString *)stringAtChartForIndex:(NSUInteger)index {
    NSAttributedString *string;
    if (self.currentTecNode) {
        HACChartDataEntry *data = [self.currentTecNode dataAtChartForIndex:index];
        HACBasicInfoEntry *basicEntry = (HACBasicInfoEntry *)[self.data dataSetWithLabel:HACBasicDataLabel].values[0];
        switch (self.tecType) {
            case HACTecTypeVolume: {
                if ([data isKindOfClass:[HACKLineEntry class]]) {
                    HACKLineEntry *entry = (HACKLineEntry *)data;
                    double dVolum = entry.volume/(basicEntry.hand<=0?100:basicEntry.hand);//手数
                    NSString *str = (dVolum < 0.01 && dVolum > -0.01) ? @"0" : [HACChartUtils transferVolumeToStandardString:dVolum];
                    string = [self creatAttributedStrings:@[
                                                            @{@"s":@"VOL:"
                                                              ,@"f":[UIFont systemFontOfSize:kTextFontSize]
                                                              ,@"c":RGB_HEX(kDefaultTextColor)
                                                              }
                                                            ,@{@"s":str
                                                               ,@"f":[UIFont systemFontOfSize:kTextFontSize]
                                                               ,@"c":entry.trendRate>0?RGB_HEX(kRedColor):RGB_HEX(kGreenColor)
                                                               }
                                                            ]];
                } else if ([data isKindOfClass:[HACTimeLineEntry class]]) {
                    HACTimeLineEntry *entry = (HACTimeLineEntry *)data;
                    double dVolum = entry.volume/(basicEntry.hand<=0?100:basicEntry.hand);//手数
                    NSString *str = (dVolum < 0.01 && dVolum > -0.01) ? @"0" : [HACChartUtils transferVolumeToStandardString:dVolum];
                    string = [self creatAttributedStrings:@[
                                                            @{@"s":@"VOL:"
                                                              ,@"f":[UIFont systemFontOfSize:kTextFontSize]
                                                              ,@"c":RGB_HEX(kDefaultTextColor)
                                                              }
                                                            ,@{@"s":str
                                                               ,@"f":[UIFont systemFontOfSize:kTextFontSize]
                                                               ,@"c":entry.trendRate>0?RGB_HEX(kRedColor):RGB_HEX(kGreenColor)
                                                               }
                                                            ]];
                } else{
                    string = [self creatAttributedStrings:@[
                                                            @{@"s":@"VOL:"
                                                              ,@"f":[UIFont systemFontOfSize:kTextFontSize]
                                                              ,@"c":RGB_HEX(kDefaultTextColor)
                                                              }
                                                            ,@{@"s":@"0"
                                                               ,@"f":[UIFont systemFontOfSize:kTextFontSize]
                                                               ,@"c":RGB_HEX(kDefaultTextColor)
                                                               }
                                                            ]];
                }
                break;
            }
            case HACTecTypeAmount: {
                break;
            }
            case HACTecTypeMACD: {
                HACTecMACDEntry *entry = (HACTecMACDEntry *)data;
                string = [self creatAttributedStrings:@[
                                                        @{@"s":[NSString stringWithFormat:@"DIF:%.3f ",entry.dDIF]
                                                          ,@"f":[UIFont systemFontOfSize:kTextFontSize]
                                                          ,@"c":RGB_HEX(kYellowColor)
                                                          }
                                                        ,@{@"s":[NSString stringWithFormat:@"DEA:%.3f ",entry.dDEA]
                                                           ,@"f":[UIFont systemFontOfSize:kTextFontSize]
                                                           ,@"c":RGB_HEX(kBlueColor)
                                                           }
                                                        ,@{@"s":[NSString stringWithFormat:@"MACD:%.3f",entry.dMacd]
                                                           ,@"f":[UIFont systemFontOfSize:kTextFontSize]
                                                           ,@"c":RGB_HEX(kDefaultTextColor)
                                                           }
                                                        ]];
                break;
            }
            case HACTecTypeKDJ: {
                HACTecKDJEntry *entry = (HACTecKDJEntry *)data;
                _HACTecNodeKDJ *kdjnode = (_HACTecNodeKDJ *)self.currentTecNode;
                string = [self creatAttributedStrings:@[
                                                        @{@"s":[NSString stringWithFormat:@"K:%.2f ",entry.K]
                                                          ,@"f":[UIFont systemFontOfSize:kTextFontSize]
                                                          ,@"c":RGB_HEX(kDarkBlueColor)
                                                          }
                                                        ,@{@"s":[NSString stringWithFormat:@"D:%.2f ",entry.D]
                                                           ,@"f":[UIFont systemFontOfSize:kTextFontSize]
                                                           ,@"c":RGB_HEX(kDarkPinkColor)
                                                           }
                                                        ,@{@"s":[NSString stringWithFormat:@"J:%.2f ",entry.J]
                                                           ,@"f":[UIFont systemFontOfSize:kTextFontSize]
                                                           ,@"c":RGB_HEX(kRedColor)
                                                           }
                                                        ,@{@"s":[NSString stringWithFormat:@"KDJ(%ld,%ld,%ld)",(long)kdjnode.N,kdjnode.M1,kdjnode.M2]
                                                           ,@"f":[UIFont systemFontOfSize:kTextFontSize]
                                                           ,@"c":RGB_HEX(kDefaultTextColor)
                                                           }
                                                        ]];
                break;
            }
            case HACTecTypeRSI: {
                HACTecRSIEntry *entry = (HACTecRSIEntry *)data;
                string = [self creatAttributedStrings:@[
                                                        @{@"s":[NSString stringWithFormat:@"RSI1:%.3f ",entry.dRSI1]
                                                          ,@"f":[UIFont systemFontOfSize:kTextFontSize]
                                                          ,@"c":RGB_HEX(kDarkBlueColor)
                                                          }
                                                        ,@{@"s":[NSString stringWithFormat:@"RSI2:%.3f ",entry.dRSI2]
                                                           ,@"f":[UIFont systemFontOfSize:kTextFontSize]
                                                           ,@"c":RGB_HEX(kDarkPinkColor)
                                                           }
                                                        ,@{@"s":[NSString stringWithFormat:@"RSI3:%.3f ",entry.dRSI3]
                                                           ,@"f":[UIFont systemFontOfSize:kTextFontSize]
                                                           ,@"c":RGB_HEX(kRedColor)
                                                           }
                                                        ]];
                break;
            }
            case HACTecTypeBOLL: {
                HACTecBOLLEntry *entry = (HACTecBOLLEntry *)data;
                string = [self creatAttributedStrings:@[
                                                        @{@"s":[NSString stringWithFormat:@"MID:%.3f ",entry.MB]
                                                          ,@"f":[UIFont systemFontOfSize:kTextFontSize]
                                                          ,@"c":RGB_HEX(kIndicatorLineColor0)
                                                          }
                                                        ,@{@"s":[NSString stringWithFormat:@"UPPER:%.3f ",entry.UP]
                                                           ,@"f":[UIFont systemFontOfSize:kTextFontSize]
                                                           ,@"c":RGB_HEX(kIndicatorLineColor1)
                                                           }
                                                        ,@{@"s":[NSString stringWithFormat:@"LOWER:%.3f ",entry.DN]
                                                           ,@"f":[UIFont systemFontOfSize:kTextFontSize]
                                                           ,@"c":RGB_HEX(kIndicatorLineColor2)
                                                           }
                                                        ]];
                break;
            }
            case HACTecTypePSY: {
                HACTecPSYEntry *entry = (HACTecPSYEntry *)data;
                string = [self creatAttributedStrings:@[
                                                        @{@"s":[NSString stringWithFormat:@"PSY:%.3f ",entry.PSY]
                                                          ,@"f":[UIFont systemFontOfSize:kTextFontSize]
                                                          ,@"c":RGB_HEX(kIndicatorLineColor0)
                                                          }
                                                        ,@{@"s":[NSString stringWithFormat:@"PSYMA:%.3f ",entry.PSYMA]
                                                           ,@"f":[UIFont systemFontOfSize:kTextFontSize]
                                                           ,@"c":RGB_HEX(kIndicatorLineColor1)
                                                           }
                                                        ]];
                break;
            }
            case HACTecTypeOBV: {
                HACTecOBVEntry *entry = (HACTecOBVEntry *)data;
                string = [self creatAttributedStrings:@[
                                                        @{@"s":[NSString stringWithFormat:@"OBV:%@ ",[HACChartUtils transferVolumeToStandardString:entry.OBV]]
                                                          ,@"f":[UIFont systemFontOfSize:kTextFontSize]
                                                          ,@"c":RGB_HEX(kIndicatorLineColor0)
                                                          }
                                                        ,@{@"s":[NSString stringWithFormat:@"OBVMA:%@ ",[HACChartUtils transferVolumeToStandardString:entry.OBV]]
                                                           ,@"f":[UIFont systemFontOfSize:kTextFontSize]
                                                           ,@"c":RGB_HEX(kIndicatorLineColor1)
                                                           }
                                                        ]];
                break;
            }
            case HACTecTypeDMI: {
                HACTecDMIEntry *entry = (HACTecDMIEntry *)data;
                string = [self creatAttributedStrings:@[
                                                        @{@"s":[NSString stringWithFormat:@"PDI:%.2f ",entry.PDI]
                                                          ,@"f":[UIFont systemFontOfSize:kTextFontSize]
                                                          ,@"c":RGB_HEX(kIndicatorLineColor0)
                                                          }
                                                        ,@{@"s":[NSString stringWithFormat:@"MDI:%.2f ",entry.MDI]
                                                           ,@"f":[UIFont systemFontOfSize:kTextFontSize]
                                                           ,@"c":RGB_HEX(kIndicatorLineColor1)
                                                           }
                                                        ,@{@"s":[NSString stringWithFormat:@"ADX:%.2f ",entry.ADX]
                                                           ,@"f":[UIFont systemFontOfSize:kTextFontSize]
                                                           ,@"c":RGB_HEX(kIndicatorLineColor2)
                                                           }
                                                        ,@{@"s":[NSString stringWithFormat:@"ADXR:%.2f ",entry.ADXR]
                                                           ,@"f":[UIFont systemFontOfSize:kTextFontSize]
                                                           ,@"c":RGB_HEX(kIndicatorLineColor3)
                                                           }
                                                        ]];
                break;
            }
            case HACTecTypeWR: {
                HACTecWREntry *entry = (HACTecWREntry *)data;
                string = [self creatAttributedStrings:@[
                                                        @{@"s":[NSString stringWithFormat:@"WR1:%.2f ",entry.W_R]
                                                          ,@"f":[UIFont systemFontOfSize:kTextFontSize]
                                                          ,@"c":RGB_HEX(kIndicatorLineColor0)
                                                          }
                                                        ,@{@"s":[NSString stringWithFormat:@"WR2:%.2f ",entry.W_R2]
                                                           ,@"f":[UIFont systemFontOfSize:kTextFontSize]
                                                           ,@"c":RGB_HEX(kIndicatorLineColor1)
                                                           }
                                                        ]];
                break;
            }
            case HACTecTypeASI: {
                HACTecASIEntry *entry = (HACTecASIEntry *)data;
                string = [self creatAttributedStrings:@[
                                                        @{@"s":[NSString stringWithFormat:@"ASI:%.2f ",entry.ASI]
                                                          ,@"f":[UIFont systemFontOfSize:kTextFontSize]
                                                          ,@"c":RGB_HEX(kIndicatorLineColor0)
                                                          }
                                                        ,@{@"s":[NSString stringWithFormat:@"ASIMA:%.2f ",entry.ASIMA]
                                                           ,@"f":[UIFont systemFontOfSize:kTextFontSize]
                                                           ,@"c":RGB_HEX(kIndicatorLineColor1)
                                                           }
                                                        ]];
                break;
            }
            case HACTecTypeDMA: {
                HACTecDMAEntry *entry = (HACTecDMAEntry *)data;
                string = [self creatAttributedStrings:@[
                                                        @{@"s":[NSString stringWithFormat:@"DDD:%.2f ",entry.DDD]
                                                          ,@"f":[UIFont systemFontOfSize:kTextFontSize]
                                                          ,@"c":RGB_HEX(kIndicatorLineColor0)
                                                          }
                                                        ,@{@"s":[NSString stringWithFormat:@"AMA:%.2f ",entry.AMA]
                                                           ,@"f":[UIFont systemFontOfSize:kTextFontSize]
                                                           ,@"c":RGB_HEX(kIndicatorLineColor1)
                                                           }
                                                        ]];
                break;
            }
            case HACTecTypeBIAS: {
                HACTecBIASEntry *entry = (HACTecBIASEntry *)data;
                string = [self creatAttributedStrings:@[
                                                        @{@"s":[NSString stringWithFormat:@"BIAS1:%.2f ",entry.BIAS_0]
                                                          ,@"f":[UIFont systemFontOfSize:kTextFontSize]
                                                          ,@"c":RGB_HEX(kIndicatorLineColor0)
                                                          }
                                                        ,@{@"s":[NSString stringWithFormat:@"BIAS2:%.2f ",entry.BIAS_1]
                                                           ,@"f":[UIFont systemFontOfSize:kTextFontSize]
                                                           ,@"c":RGB_HEX(kIndicatorLineColor1)
                                                           }
                                                        ,@{@"s":[NSString stringWithFormat:@"BIAS3:%.2f ",entry.BIAS_2]
                                                           ,@"f":[UIFont systemFontOfSize:kTextFontSize]
                                                           ,@"c":RGB_HEX(kIndicatorLineColor2)
                                                           }
                                                        ]];
                break;
            }
            case HACTecTypeVR: {
                HACTecVREntry *entry = (HACTecVREntry *)data;
                string = [self creatAttributedStrings:@[
                                                        @{@"s":[NSString stringWithFormat:@"VR:%.2f ",entry.VR]
                                                          ,@"f":[UIFont systemFontOfSize:kTextFontSize]
                                                          ,@"c":RGB_HEX(kIndicatorLineColor0)
                                                          }
                                                        ]];
                break;
            }
            case HACTecTypeCCI: {
                HACTecCCIEntry *entry = (HACTecCCIEntry *)data;
                string = [self creatAttributedStrings:@[
                                                        @{@"s":[NSString stringWithFormat:@"CCI:%.2f ",entry.CCI]
                                                          ,@"f":[UIFont systemFontOfSize:kTextFontSize]
                                                          ,@"c":RGB_HEX(kIndicatorLineColor0)
                                                          }
                                                        ]];
                break;
            }
        }
    }
    return string;
}

- (NSAttributedString*)creatAttributedStrings:(NSArray<NSDictionary*>*)stringArray {
    NSMutableAttributedString *retAttrStr ;
    if (stringArray) {
        retAttrStr = [[NSMutableAttributedString alloc] init];
        [stringArray enumerateObjectsUsingBlock:^(NSDictionary * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
            NSString *str = obj[@"s"];
            UIFont *font = obj[@"f"];
            UIColor *color = obj[@"c"];
            NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:str
                                                                                        attributes:@{NSFontAttributeName: font                                 ,NSForegroundColorAttributeName:color                                   }];
            [retAttrStr appendAttributedString:attrStr];
        }];
    }
    return retAttrStr;
}

- (void)setTec:(HACTecType)type withParam:(NSArray<NSNumber *> *)param {
    if (type == self.tecType) {
        switch (type) {
            case HACTecTypeMACD: {
                if (param.count>=3) {
                    _HACTecNodeMACD *node = (_HACTecNodeMACD *)self.currentTecNode;
                    node.ema1 = [param[0] integerValue];
                    node.ema2 = [param[1] integerValue];
                    node.dea = [param[2] integerValue];
                }
                break;
            }
            case HACTecTypeKDJ: {
                if (param.count>=3) {
                    _HACTecNodeKDJ *node = (_HACTecNodeKDJ *)self.currentTecNode;
                    node.N = [param[0] integerValue];
                    node.M1 = [param[1] integerValue];
                    node.M2 = [param[2] integerValue];
                }
                break;
            }
            case HACTecTypeRSI: {
                if (param.count>=3) {
                    _HACTecNodeRSI *node = (_HACTecNodeRSI *)self.currentTecNode;
                    node.N1 = [param[0] integerValue];
                    node.N2 = [param[1] integerValue];
                    node.N3 = [param[2] integerValue];
                }
                break;
            }
            case HACTecTypeBOLL: {
                if (param.count>=2) {
                    _HACTecNodeBOLL *node = (_HACTecNodeBOLL *)self.currentTecNode;
                    node.ma = [param[0] integerValue];
                    node.w = [param[1] integerValue];
                }
                break;
            }
            case HACTecTypePSY: {
                if (param.count>=2) {
                    _HACTecNodePSY *node = (_HACTecNodePSY *)self.currentTecNode;
                    node.N = [param[0] integerValue];
                    node.M = [param[1] integerValue];
                }
                break;
            }
            case HACTecTypeOBV: {
                if (param.count>=1) {
                    _HACTecNodeOBV *node = (_HACTecNodeOBV *)self.currentTecNode;
                    node.M = [param[0] integerValue];
                }
                break;
            }
            case HACTecTypeDMI: {
                if (param.count>=2) {
                    _HACTecNodeDMI *node = (_HACTecNodeDMI *)self.currentTecNode;
                    node.N = [param[0] integerValue];
                    node.M = [param[1] integerValue];
                }
                break;
            }
            case HACTecTypeWR: {
                if (param.count>=2) {
                    _HACTecNodeWR *node = (_HACTecNodeWR *)self.currentTecNode;
                    node.shortEMA = [param[0] integerValue];
                    node.longEMA = [param[1] integerValue];
                }
                break;
            }
            case HACTecTypeASI: {
                if (param.count>=1) {
                    _HACTecNodeASI *node = (_HACTecNodeASI *)self.currentTecNode;
                    node.M = [param[0] integerValue];
                }
                break;
            }
            case HACTecTypeDMA: {
                if (param.count>=3) {
                    _HACTecNodeDMA *node = (_HACTecNodeDMA *)self.currentTecNode;
                    node.shortEMA = [param[0] integerValue];
                    node.longEMA = [param[1] integerValue];
                    node.M = [param[2] integerValue];
                }
                break;
            }
            case HACTecTypeBIAS: {
                if (param.count>=3) {
                    _HACTecNodeBIAS *node = (_HACTecNodeBIAS *)self.currentTecNode;
                    node.N1 = [param[0] integerValue];
                    node.N2 = [param[1] integerValue];
                    node.N3 = [param[2] integerValue];
                }
                break;
            }
            case HACTecTypeVR: {
                if (param.count>=1) {
                    _HACTecNodeVR *node = (_HACTecNodeVR *)self.currentTecNode;
                    node.N = [param[0] integerValue];
                }
                break;
            }
            case HACTecTypeCCI: {
                if (param.count>=1) {
                    _HACTecNodeCCI *node = (_HACTecNodeCCI *)self.currentTecNode;
                    node.N = [param[0] integerValue];
                }
                break;
            }
            default:
                break;
        }
    }
}
@end
